[20251206] BOJ / G2 / 환승 / 한종욱 #1599
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/5214
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
하이퍼튜브가 K개의 역을 서로 연결한다. 1번역부터 N번역으로 가는데 방문하는 최소 역의 개수는?
🔍 풀이 방법
1개의 하이퍼튜브를 1개의 정점으로 생각했다.
각 하이퍼튜브에 포함되는 역을
BitSet에 저장하고 1을 포함하고 있는 하이퍼튜브와 N을 포함하고 있는 하이퍼튜브를 구분했다.그 다음 BFS를 통해 지나가는 역의 개수를 구했다.
N이 1일 경우엔 1개이므로 그 부분은 보정했다.
⏳ 회고
그냥 HashSet과 BitSet의 속도 차이는 어마어마하다.